﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Compilex.Automata;
using Compilex.BaseLibrary;

namespace Compilex.Lexer.Automata
{
    public class CaracterDFA : DFA
    {
        public CaracterDFA()
        {
            this.StartState = BuildAutomaton();
        }

        private DFAState BuildAutomaton()
        {
            DFAState startState = new DFAState("q0");
            DFAState textState = new DFAState("q1");
            DFAState acceptState = new DFAState("q2", true);
            // automato de caracter aceita tudo entre aspas simples, semantico que se vire
            startState.AddTransition('\'', textState);

            textState.AddTransition('\'', acceptState);
            textState.AddTransition(c => c != "'", textState);
            
            return startState;
        }
    }
}
